//
//  DrawingView.h
//  etionUI
//
//  Created by wangjian on 5/14/13.
//
//

#import <UIKit/UIKit.h>
#import "GrowingTextViewController.h"

//---------------------------------------------------------------------
// Drawing Tools

typedef enum
{
    EDrawingToolTypePen,
    EDrawingToolTypeBrush,
    EDrawingToolTypeFog
} EDrawingToolType;

@interface CDrawingTool : UIBezierPath
{
    UIColor *m_toolColor;
    CGFloat m_toolWidth;
    CGPoint m_startPoint;
    CGPoint m_endPoint;
    CGBlendMode m_blendMode;
}

@property (nonatomic, retain) UIColor *m_toolColor;
@property (nonatomic, assign) CGFloat m_toolWidth;
@property (nonatomic, assign) CGPoint m_startPoint;
@property (nonatomic, assign) CGPoint m_endPoint;
@property (nonatomic, assign) CGBlendMode m_blendMode;

- (void)setInitialPoint:(CGPoint)firstPoint;
- (void)moveFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint;

- (void)draw;

@end

@interface CDrawingToolPen : CDrawingTool

@end

@interface CDrawingToolBrush : CDrawingTool

@end

@interface CDrawingToolFog : CDrawingTool

@end

//---------------------------------------------------------------------
// Drawing view

@class CDrawingView;
@protocol CDrawingViewDelegate <NSObject>

@optional
- (BOOL)drawingViewShouldBeginDrawing:(CDrawingView *)view;
- (void)drawingViewDidBeginDrawing:(CDrawingView *)view;
- (void)drawingViewDidEndDrawing:(CDrawingView *)view;

@end

@interface CDrawingView : UIView
{
    UIColor *m_toolColor;
    CGFloat m_toolWidth;
    EDrawingToolType m_drawingToolType;
    UIImage *m_image;
    BOOL m_bEraser;
}

@property (nonatomic, assign) id<CDrawingViewDelegate> delegate;

@property (nonatomic, retain) UIColor *m_toolColor;
@property (nonatomic, assign) CGFloat m_toolWidth;
@property (nonatomic, assign) BOOL m_bEraser;
@property (nonatomic, assign) EDrawingToolType m_drawingToolType;
@property (nonatomic, readonly) UIImage *m_image;

@end

@class CDrawingBoardView;
@protocol CDrawingBoardViewDelegate <NSObject>

- (void)drawingBoardViewCancelEdit:(CDrawingBoardView *)view;
- (void)drawingBoardViewFinishedEdit:(CDrawingBoardView *)view;

@end

@interface CDrawingBoardView : UIView

@property (nonatomic, assign) CGRect drawingFrame;
@property (nonatomic, readonly) CDrawingView *drawingView;
@property (nonatomic, assign) id<CDrawingBoardViewDelegate> delegate;

- (void)showButtonsAnimated:(BOOL)animated complete:(void (^)(BOOL finished))complete;
- (void)hideButtonsAnimated:(BOOL)animated complete:(void (^)(BOOL finished))complete;

@end
